package com.shop2cn.app.liveseller.testcase;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections.map.HashedMap;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.utils.TestDataManager;
import com.shop2cn.app.liveseller.parameter.*;
import com.shop2cn.app.liveseller.service.*;
import com.ymatou.iapi.godmch.parameter.setBizConfigBean;
import com.ymttest.business.service.AuthCallServiceV2;
import com.ymttest.business.service.LiveRoomShop2cnCallService;
import com.ymttest.business.service.shenqi.GodmchManageCallService;
import com.ymttest.database.model.livesellerShop2cn.*;
import com.ymttest.database.sqlwapper.livesellerShop2cn.LiveRoomShop2cnWapper;
/**
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_SubscriptionStatus{
	private static SubscriptionStatusCall SubscriptionStatusCall;
	private static int sellerId ;
	private static String token ;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("直播功能开通查询");
		try {
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}

	@Before
	public void caseUp() {
		SubscriptionStatusCall=new SubscriptionStatusCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(SubscriptionStatusCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SubscriptionStatus_001() {
		Logger.start(true,"直播功能开通查询成功");
		try {
			sellerId = GodmchManageCallService.CreateSellerMch();
			token=AuthCallServiceV2.createToken(sellerId, "app");
			SubscriptionStatusCall.setData("{}");
			String head="accesstoken="+token;
			Logger.debug("ymt-pars:"+ head);
			SubscriptionStatusCall.addHeader("ymt-pars", head);
			SubscriptionStatusCall.callService();			
//			liveDto
			Logger.verifyNotNull(SubscriptionStatusCall.getReturnData(), "返回非空");
			Logger.verifyEquals("false", SubscriptionStatusCall.getString("available"), "是否开通");
			Logger.verifyEquals("false", SubscriptionStatusCall.getString("remind"), "是否提醒开通");
			Logger.verifyEquals("null", SubscriptionStatusCall.getString("remindText"), "提醒文案");
			//文案手工check
			Logger.verifyNotNull(SubscriptionStatusCall.getString("packagePriceText"), "套餐价格文案");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_SubscriptionStatus_002() {
		Logger.start(true,"直播功能开通查询成功");
		try {
			sellerId = GodmchManageCallService.CreateSellerMch();
			token=AuthCallServiceV2.createToken(sellerId, "app");
			setBizConfigBean bizbean=GodmchManageCallService.initSetBizConfig("live_broadcast_type","5");
			GodmchManageCallService.setBizConfig(bizbean);
			GodmchManageCallService.SetTrueMchChargeConfig(sellerId, Arrays.asList(0,1,2,3,4,5),true);
			GodmchManageCallService.ApplyCharge(sellerId, 5, 7);	
			SubscriptionStatusCall.setData("{}");
			String head="accesstoken="+token;
			Logger.debug("ymt-pars:"+ head);
			SubscriptionStatusCall.addHeader("ymt-pars", head);
			SubscriptionStatusCall.callService();			
//			liveDto
			Logger.verifyNotNull(SubscriptionStatusCall.getReturnData(), "返回非空");
			Logger.verifyEquals("false", SubscriptionStatusCall.getString("available"), "是否开通");
			Logger.verifyEquals("false", SubscriptionStatusCall.getString("remind"), "是否提醒开通");
			Logger.verifyEquals("null", SubscriptionStatusCall.getString("remindText"), "提醒文案");
			//文案手工check
			Logger.verifyNotNull(SubscriptionStatusCall.getString("packagePriceText"), "套餐价格文案");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}